
<div ng-controller="CarProfitCtrl">
	
<div ng-include="'/templates/paramsSelect.html'"></div>
	<div class="page-heading">
		<ul class="breadcrumb">
			<li><a href="javascript:;">报表管理</a></li>
			<li >销售分析</li>
			
			<li class="active" ng-hide="menuName">新车预估毛利报表</li>
			<li class="active" ng-show="menuName" ng-bind="menuName"></li>
			<span style="margin-right:10px;"  class="btn btn-danger btn-xs pull-right " ng-show="flag" ng-click="delFlag('/sales/car_profit/')"><i class="fa fa-times"></i> 删除 </span>
			<span style="margin-right:10px;"  class="btn btn-info btn-xs pull-right " ng-click="addFlag('#/sales/car_profit/')"><i class="fa fa-star"></i> 收藏 </span>
		
		</ul>
	</div>
	<!-- 页面头部  end-->

	<!--页面内容显示区域-->
	<div class="wrapper">


		<div class="row">
			<div class="col-sm-12">
				<!--表格显示区域-->
				<section class="panel">
					<!--区块头 显示表格名称和功能按钮-->
					<header class="panel-heading">
						新车预估毛利信息
						<!--控制按钮-->
						<span class="tools pull-right"> <!--收起-->
							<button type="button" class="btn btn-success pull-left" ng-click="SearchData()"
								style="margin-left: 5px;">
								<i class="fa fa-search" ></i> 查询
							</button>
							<button type="button" class="btn btn-info  pull-left" ng-click="ExportData()"
								style="margin-left: 5px;">
								<i class="fa fa-table"></i> 导出EXCEL
							</button> <a href="javascript:;" class="fa fa-chevron-up form_display"></a>

						</span>
					</header>
					<!--区块body 显示表格内容-->
					<div class="panel-body form-horizontal form_hide">
						<div class="row">
						
						<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">事业部</label>
										<div class="col-lg-8 col-sm-7">
										<input type="text" id="group_name" ng-keyup="clearGroup()" name="group_name"   class="form-control select_edit form_params" />
                                            <ul class="select_list">
                                                  <li ng-repeat="e in groups" ng-click='LoadBrands(e.group_name)' val_code="{{e.group_name}}" val_name="{{e.group_name}}">{{e.group_name}}</li>
                                            </ul>  
                                            </div>
								</div>
							</div>
							
							<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">店面品牌</label>
									<div class="col-lg-8 col-sm-7">
										<input type="text" id="entity_brand_name"   ng-keyup="clearGroupBrand()" name="entity_brand_name" class="form-control select_edit form_params" value=""/>
                                            <ul class="select_list">
                                                  <li ng-repeat="e in gBrands" ng-click='LoadEntitys(e)' val_code="{{e.brand_code}}" val_name="{{e.brand_name}}">{{e.brand_name}}</li>
                                            </ul> 
									</div>
								</div>
							</div>
							
							
							<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" for="inputEmail1">店面信息</label>
									<div class="col-lg-8 col-sm-7">
											<input type="text" id="entity_name"  ng-keyup="clearGroupBrandEntity()" name="entity_name" class="form-control select_edit form_params" value=""/>
                                            <ul class="select_list">
                                                  <li ng-repeat="e in entitys"  ng-click='LoadEntityBrands(e)' val_code="{{e.entity_code}}" val_name="{{e.entity_name}}">{{e.entity_name}}({{e.entity_code}})</li>
                                            </ul>  
									</div>
								</div>
							</div>
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">VIN</label>
									<div class="col-lg-8 col-sm-7">
										<input name="vin" class="form-control form_params" />
									</div>
								</div>
							</div>
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" for="inputEmail1">交车日期</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											<input type="text" name="confirmed_date1" class="form-control form_params" id="confirmed_date1"
												onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'confirmed_date2\')||\'2020-10-01\'}'})">
										</div>
									</div>
								</div>
							</div>
                            
                            <div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label text-center" for="inputEmail1">至</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											<input type="text" name="confirmed_date2" class="form-control form_params" id="confirmed_date2"
												onFocus="WdatePicker({minDate:'#F{$dp.$D(\'confirmed_date1\')}',maxDate:'2020-10-01'})">
										</div>
									</div>
								</div>
							</div>
							
							<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">品牌</label>
									<div class="col-lg-8 col-sm-7">
										<select name="brand_code"  ng-model="ch_brand" class="form-control form_params">
											<option></option>
											<option  ng-repeat="b in brands"  value="{{b.brand_code}}">{{b.brand_name}}</option>
										</select>
									</div>
								</div>
							</div>

							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">车系</label>
									<div class="col-lg-8 col-sm-7">
										<select name="series_code" id="series_code" ng-model="$root.ch_serie" class="form-control form_params">
											<option></option>
											<option  ng-repeat="b in series" value="{{b.series_code}}">{{b.series_name}}</option>
										</select>
									</div>
								</div>
							</div>

							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">车型</label>
									<div class="col-lg-8 col-sm-7">
										<select name="model_code" id="model_code" class="form-control form_params">
											<option></option>
											<option  ng-repeat="b in $parent.models" value="{{b.model_code}}">{{b.model_name}}</option>
										</select>
									</div>
								</div>
							</div>
							
						</div>
					</div>
				</section>

				<section class="panel">
					<!--区块头 显示表格名称和功能按钮-->
					<header class="panel-heading">
						新车预估毛利报表
						
						<div class="option_check_list" style="display: inline-block;"></div>

						<!--控制按钮-->
						<span class="tools pull-right"> <!--收起--> <a
							href="javascript:;" class="fa fa-chevron-down"></a>
						</span>
						<div class="pull-right"
							style="margin-right: 10px; margin-top: -3px; display: inline-block">
							<button type="button" class="btn btn-danger btn-sm " href="#paramsSelect"
								data-toggle="modal">
								<i class="fa fa-plus"></i> 在结果集中筛选
							</button>
							<button type="button" class="btn btn-success btn-sm"
								id="search_table" ng-click="SearchData();">
								<i class="fa fa-search"></i> 查询表格
							</button>
						</div>
					</header>
					<!--区块body 显示表格内容-->
					<div class="panel-body form-horizontal ">

						<div class="adv-table" style="overflow-x: scroll">
							<table id="carProfitTable"
								class="table table-striped table-bordered nowrap  dataTable no-footer table_store table-hover float_head"
								cellspacing="0" width="100%">
								<thead>
									<tr>
										<th ng-show="!cols.contains('index')" rowspan="2" column="index">序号</th>
										<th ng-show="!cols.contains('entity_code')" rowspan="2" column="entity_code">店面编号</th>
										<th ng-show="!cols.contains('entity_name')" rowspan="2" column="entity_name">店面名称</th>
										<th ng-show="!cols.contains('entity_brand_name')" rowspan="2" column="entity_brand_name">店面品牌</th>
										<th ng-show="!cols.contains('group_name')" rowspan="2" column="group_name">事业部</th>
										<th ng-show="!cols.contains('series_name')" rowspan="2" column="series_name">车系</th>
										<th ng-show="!cols.contains('model_name')" rowspan="2" column="model_name">车型</th>
										<th ng-show="!cols.contains('media_type')" rowspan="2" column="media_type">销售渠道</th>
										<th ng-show="!cols.contains('sold_by_name')" rowspan="2" column="sold_by_name">销售顾问</th>
										<th qtype='date' ng-show="!cols.contains('confirmed_date')" rowspan="2" column="confirmed_date">交车时间</th>
										<th ng-show="!cols.contains('vin')" rowspan="2" column="vin">底盘号</th>
										<th ng-show="!cols.contains('customer_name')" rowspan="2" column="customer_name">客户名称</th>
										<th ng-show="!cols.contains('phone')" rowspan="2" column="phone">联系电话</th>
										<th qtype='double' ng-show="!cols.contains('directive_price')" rowspan="2" column="directive_price">厂家指导价(含税)</th>
										<th qtype='double' ng-show="!cols.contains('purchase_price')" rowspan="2" column="purchase_price">厂家开票价格(含税)</th>
										<th qtype='double' ng-show="!cols.contains('actual_price')" rowspan="2" column="actual_price">新车销售价格(含税)</th>
										<th qtype='double' ng-show="!cols.contains('par_profit')" rowspan="2" column="par_profit">票面毛利(不含税)</th>
										<th qtype='double' ng-show="!cols.contains('par_profit_rate')" rowspan="2" column="par_profit_rate">票面毛利率(不含税)</th>
										<th qtype='double' ng-show="!cols.contains('pre_rebate')" rowspan="2" column="pre_rebate">预估佣金(含阶段性政策合计)</th>
										<th qtype='double' ng-show="!cols.contains('sales_prof_total')" rowspan="2" column="sales_prof_total">预估单车票面+佣金</th>
										<th colspan="16" >边际收入（精品实际销售价格含成本）</th>
                                        <th qtype='double' rowspan="2" qtype='double' ng-show="!cols.contains('bound_profit')" column="bound_profit">预估边际收益小计</th>
										<th qtype='double' rowspan="2" qtype='double' ng-show="!cols.contains('total_profit')" column="total_profit">预估单车综合毛利</th>
									</tr>
								
									<tr>
										<th qtype='double' ng-show="!cols.contains('dec_direct_amount')" column="dec_direct_amount">精品指导价合计</th>
										<th qtype='double' ng-show="!cols.contains('dec_total_amount')" column="dec_total_amount">精品实际销售价格</th>
										<th qtype='double' ng-show="!cols.contains('dec_discount_rate')" column="dec_discount_rate">折扣率</th>
										<th qtype='double' ng-show="!cols.contains('dec_cost_amount')" column="dec_cost_amount">精品成本</th>
										<th qtype='double' ng-show="!cols.contains('dec_profit_amount')" column="dec_profit_amount">精品毛利</th>
										<th qtype='double' ng-show="!cols.contains('dec_profit_rate')" column="dec_profit_rate">精品毛利率</th>
										<th qtype='double' ng-show="!cols.contains('loan_amount')" column="loan_amount">贷款金额</th>
										<th qtype='double' ng-show="!cols.contains('loan_profit')" column="loan_profit">分期毛利</th>
										<th qtype='double' ng-show="!cols.contains('loan_rate')" column="loan_rate">手续费率</th>
										<th ng-show="!cols.contains('insuration_name')" column="insuration_name">保险公司</th>
										<th qtype='double' ng-show="!cols.contains('jq_total_amount')" column="jq_total_amount">交强险投保金额</th>
										<th qtype='double' ng-show="!cols.contains('jq_rebate_rate')" column="jq_rebate_rate">交强险返点</th>
										<th qtype='double' ng-show="!cols.contains('sy_total_amount')" column="sy_total_amount">商业险投保金额</th>
										<th qtype='double' ng-show="!cols.contains('sy_rebate_rate')" column="sy_rebate_rate">商业险返点</th>
										<th qtype='double' ng-show="!cols.contains('insurance_profit')" column="insurance_profit">保险预估毛利</th>
										<th qtype='double' ng-show="!cols.contains('other_profit')" column="other_profit">上牌及其他毛利</th>
									</tr>
								</thead>
								<tbody>
									<tr ng-repeat="c in carProfit">
										<td ng-show="!cols.contains('index')" class="">{{$index + 1 }}</td>
										<td ng-show="!cols.contains('entity_code')" class="left" column="entity_code">{{c.entity_code}}</td>
										<td ng-show="!cols.contains('entity_name')" class="left" column="entity_name">{{c.entity_name}}</td>
										<td ng-show="!cols.contains('entity_brand_name')" class="left" column="entity_brand_name">{{c.entity_brand_name}}</td>
										<td ng-show="!cols.contains('group_name')" class="" column="group_name">{{c.group_name}}</td>
										<td ng-show="!cols.contains('series_name')" class="">{{c.series_name}}</td>
										<td ng-show="!cols.contains('model_name')" class="">{{c.model_name}}</td>
										<td ng-show="!cols.contains('media_type')" class="">{{c.media_type}}</td>
										<td ng-show="!cols.contains('sold_by_name')" class="">{{c.sold_by_name}}</td>
										<td ng-show="!cols.contains('confirmed_date')" class="">{{c.confirmed_date | date : 'yyyy-MM-dd'}}</td>
										<td ng-show="!cols.contains('vin')" class="">{{c.vin}}</td>
										<td ng-show="!cols.contains('customer_name')" class="">{{c.customer_name}}</td>
										<td ng-show="!cols.contains('phone')" class="">{{c.phone | mobile}}</td>
										<td ng-show="!cols.contains('directive_price')" class="right">{{c.directive_price|number:2}}</td>
										<td ng-show="!cols.contains('purchase_price')" class="right">{{c.purchase_price|number:2}}</td>
										<td ng-show="!cols.contains('actual_price')" class="right">{{c.actual_price|number:2}}</td>
										<td ng-show="!cols.contains('par_profit')" class="right">{{(c.notax_acutal_price-c.purchase_price/(1+c.tax))|number:2}}</td>
										<td ng-show="!cols.contains('par_profit_rate')" class="right">{{(((c.notax_acutal_price-c.purchase_price/(1+c.tax))*100/c.notax_acutal_price)|number:2)+'%'}}</td>
										<td ng-show="!cols.contains('pre_rebate')" class="right">{{c.pre_rebate |number:2}}</td>
										<td ng-show="!cols.contains('sales_prof_total')" class="right">{{c.sales_prof_total |number:2}}</td>
										<td ng-show="!cols.contains('dec_direct_amount')" class="right">{{c.dec_direct_amount|number:2}}</td>
										<td ng-show="!cols.contains('dec_total_amount')" class="right">{{c.dec_total_amount|number:2}}</td>
										<td ng-show="!cols.contains('dec_discount_rate')" class="right">{{(c.dec_discount_rate|number:2)+'%'}}</td>
										<td ng-show="!cols.contains('dec_cost_amount')" class="right">{{c.dec_cost_amount|number:2}}</td>
										<td ng-show="!cols.contains('dec_profit_amount')" class="right">{{c.dec_profit_amount|number:2}}</td>
										<td ng-show="!cols.contains('dec_profit_rate')" class="right">{{(c.dec_profit_rate|number:2)+'%'}}</td>
										<td ng-show="!cols.contains('loan_amount')" class="right">{{c.loan_amount|number:2}}</td>
										<td ng-show="!cols.contains('loan_profit')" class="right">{{c.loan_profit|number:2}}</td>
										<td ng-show="!cols.contains('loan_rate')" class="right">{{(c.loan_rate |number:2)+'%'}}</td>
										<td ng-show="!cols.contains('insuration_name')" class="">{{c.insuration_name}}</td>
										<td ng-show="!cols.contains('jq_total_amount')" class="right">{{c.jq_total_amount |number:2}}</td>
										<td ng-show="!cols.contains('jq_rebate_rate')" class="right">{{(c.jq_rebate_rate|number:2)+'%'}}</td>
										<td ng-show="!cols.contains('sy_total_amount')" class="right">{{c.sy_total_amount |number:2}}</td>
										<td ng-show="!cols.contains('sy_rebate_rate')" class="right">{{(c.sy_rebate_rate |number:2)+'%'}}</td>
										<td ng-show="!cols.contains('insurance_profit')" class="right">{{c.insurance_profit |number:2}}</td>
										<td ng-show="!cols.contains('other_profit')" class="right">{{c.other_profit |number:2}}</td>
										<td ng-show="!cols.contains('bound_profit')" class="right">{{c.bound_profit |number:2}}</td>
										<td ng-show="!cols.contains('total_profit')" class="right">{{c.total_profit |number:2}}</td>
									</tr>
									
									<tr class="tbody_last_tr" ng-show="pagination.totalItems > 0">
										<td ng-show="!cols.contains('index')" class=""></td>
										<td ng-show="!cols.contains('entity_code')" class="left" column="entity_code"></td>
										<td ng-show="!cols.contains('entity_name')" class="left" column="entity_name"></td>
										<td ng-show="!cols.contains('entity_brand_name')" class="left" column="entity_brand_name"></td>
										<td ng-show="!cols.contains('group_name')" class="" column="group_name"></td>
										<td ng-show="!cols.contains('series_name')" class=""></td>
										<td ng-show="!cols.contains('model_name')" class=""></td>
										<td ng-show="!cols.contains('media_type')" class=""></td>
										<td ng-show="!cols.contains('sold_by_name')" class=""></td>
										<td ng-show="!cols.contains('confirmed_date')" class=""></td>
										<td ng-show="!cols.contains('vin')" class=""></td>
										<td ng-show="!cols.contains('customer_name')" class=""></td>
										<td ng-show="!cols.contains('phone')" class=""></td>
										<td ng-show="!cols.contains('directive_price')" class="right">{{carProfitSum.sum_directive_price.value|number:2}}</td>
										<td ng-show="!cols.contains('purchase_price')" class="right">{{carProfitSum.sum_purchase_price.value|number:2}}</td>
										<td ng-show="!cols.contains('actual_price')" class="right">{{carProfitSum.sum_actual_price.value|number:2}}</td>
										<td ng-show="!cols.contains('par_profit')" class="right">{{(carProfitSum.sum_notax_acutal_price.value - carProfitSum.sum_notax_purchase_price.value)|number:2}}</td>
										<td ng-show="!cols.contains('par_profit_rate')" class="right">{{((carProfitSum.sum_notax_acutal_price.value==0?0:((carProfitSum.sum_notax_acutal_price.value - carProfitSum.sum_notax_purchase_price.value)*100/carProfitSum.sum_notax_acutal_price.value))| number:2)+'%'}}</td>
										<td ng-show="!cols.contains('pre_rebate')" class="right">{{carProfitSum.sum_pre_rebate.value |number:2}}</td>
										<td ng-show="!cols.contains('sales_prof_total')" class="right">{{carProfitSum.sum_sales_prof_total.value|number:2}}</td>
										<td ng-show="!cols.contains('dec_direct_amount')" class="right">{{carProfitSum.sum_dec_direct_amount.value|number:2}}</td>
										<td ng-show="!cols.contains('dec_total_amount')" class="right">{{carProfitSum.sum_dec_total_amount.value|number:2}}</td>
										<td ng-show="!cols.contains('dec_discount_rate')" class="right">{{((carProfitSum.sum_dec_direct_amount.value==0?0:(carProfitSum.sum_dec_total_amount.value*100/carProfitSum.sum_dec_direct_amount.value)) |number:2)+'%'}}</td>
										<td ng-show="!cols.contains('dec_cost_amount')" class="right">{{carProfitSum.sum_dec_cost_amount.value|number:2}}</td>
										<td ng-show="!cols.contains('dec_profit_amount')" class="right">{{carProfitSum.sum_dec_profit_amount.value|number:2}}</td>
										<td ng-show="!cols.contains('dec_profit_rate')" class="right">{{ ((carProfitSum.sum_dec_total_amount.value == 0?0:(carProfitSum.sum_dec_profit_amount.value * 100 / carProfitSum.sum_dec_total_amount.value))  |number:2) +'%'}}</td>
										<td ng-show="!cols.contains('loan_amount')" class="right">{{carProfitSum.sum_loan_amount.value|number:2}}</td>
										<td ng-show="!cols.contains('loan_profit')" class="right">{{carProfitSum.sum_loan_profit.value|number:2}}</td>
										<td ng-show="!cols.contains('loan_rate')" class="right">{{((carProfitSum.sum_loan_amount.value==0?0:(carProfitSum.sum_loan_profit.value * 100 / carProfitSum.sum_loan_amount.value)) |number:2) +'%' }}</td>
										<td ng-show="!cols.contains('insuration_name')" class="right"></td>
										<td ng-show="!cols.contains('jq_total_amount')" class="right">{{carProfitSum.sum_jq_total_amount.value |number:2}}</td>
										<td ng-show="!cols.contains('jq_rebate_rate')" class="right"></td>
										<td ng-show="!cols.contains('sy_total_amount')" class="right">{{carProfitSum.sum_sy_total_amount.value |number:2}}</td>
										<td ng-show="!cols.contains('sy_rebate_rate')" class="right"></td>
										<td ng-show="!cols.contains('insurance_profit')" class="right">{{carProfitSum.sum_insurance_profit.value |number:2}}</td>
										<td ng-show="!cols.contains('other_profit')" class="right">{{carProfitSum.sum_other_profit.value |number:2}}</td>
										<td ng-show="!cols.contains('bound_profit')" class="right">{{carProfitSum.sum_bound_profit.value |number:2}}</td>
										<td ng-show="!cols.contains('total_profit')" class="right">{{carProfitSum.sum_total_profit.value |number:2}}</td>
									</tr>
								</tbody>
								
							</table>
								<div class="no-items" ng-show="pagination.totalItems <= 0">暂无数据</div>
						</div>
						<tm-pagination conf="pagination"></tm-pagination>
					</div>
				</section>
				<!--表格显示区域-->

			</div>
		</div>
	</div>
	 
</div>


<form id="export_form" action="carProfit/export"  method="post">
	<input type="hidden" name="keys" id="keys" />
	<input type="hidden" name="names" id="names" /> 
	<input type="hidden" name="params" id="params" />
	<input type="hidden" name="search_opt" id="search_opt" /> 
	<input type="hidden" name="file_name" id="file_name" value="新车预估毛利报表"/>
</form>
